<template>
  <div>
    <ul class="todo-main">
      <!-- (3) 原来是直接在父组件上for循环传给子组件的
           (4) 原来for循环的个数就等于被放v-for这个标签的个数
           (5) 别忘了传值的时候前面那个才是要传的值名字，后面那个是数据源
      -->
      <MyItem v-for="todoObj in todos" :key="todoObj.id" :todo="todoObj" />
    </ul>
  </div>
</template>

<script>
import MyItem from "./MyItem.vue";

export default {
  name: "MyList",
  components: { MyItem },
  props: ["todos"],
};
</script>

<style>
/*main*/
.todo-main {
  margin-left: 0;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}
.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>
